ListNode* swapNodes(ListNode* head, int k) 
    {
        ListNode *p = head;
        int x1, x2;
        int m = k;
        while(p->next && --m)
        {
            p = p->next;
        }
        x1 = p->val;

        ListNode *fast = head, *slow = head;
        while(k--)
        {
            fast = fast->next;
        }
        while(fast)
        {
            fast = fast->next;
            slow = slow->next;
        }

        x2 = slow->val;
        slow->val = x1;
        p->val = x2;

        return head;
    }